/*
 * @(#)HtmlDynamicResult.java $version 2010. 8. 11
 *
 * Copyright 2007-2010 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nhncorp.usf.core.result.direct;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import com.nhncorp.lucy.web.helper.ServletHelper;
import com.nhncorp.usf.core.config.runtime.ResultPageInfo;
import com.nhncorp.usf.core.util.StringUtil;

/**
 * {@link ResultPageInfos}의 Path 에 정의된 내용을 내보내는 {@link Result}.
 *
 * @author Web Platform Development Team
 */
@SuppressWarnings("serial")
public class HtmlDynamicResult extends AbstractDirectResult {
    /**
     * 전달된 {@link com.nhncorp.lucy.common.util.DataMap} 정보를 {@link com.nhncorp.usf.core.config.runtime.ResultPageInfo} 에 적용하여 결과 페이지 내보냄.
     *
     * @param resultPage the page information
     * @param dataMap    the usf result data
     * @throws Exception the Exception
     */
    public void execute(ResultPageInfo resultPage, Map<String, Object> dataMap) throws Exception {
        String src = resultPage.getSrc();
        src = StringUtil.getNewSrc(src, dataMap);
        HttpServletResponse response = ServletHelper.getResponse();
        response.setContentType("text/html; charset=" + getPageEncoding());
        response.getWriter().write(src);
    }
}
